#include <iostream>
#include<unordered_set>
#include<mutex>
#include<thread>
#include<algorithm>
using namespace std;
int ready = 0;
void Range(vector<int>&v)
{
	if(v.size()==0){}
	if (v.size() == 1) {}
	sort(v.begin(), v.end());
	//bool flag = 1;
	cout << v[0];
	for (int i = 1; i < v.size(); i++)
	{
		//if (i == v.size() - 1) { cout << v[i] << " " << v[i]; }
		//if (flag)
		{
		//if(v[i]==v[i-1])
			if (v[i-1] + 1 == v[i])
			{
				if (i == v.size() - 1) { cout << v[i]; break; }
				continue;
			}
			else
			{
				cout <<" " <<v[i-1] <<endl;
				cout << v[i];
				if (i == v.size() - 1) { cout << v[i]; }
			}
		}


	}
}
int main()
{
	vector<int>v;
	int n;
	cin >> n;
	v.resize(n);
	for (int i = 0; i < n; i++)
	{
		cin >> v[i];
	}
	Range(v);
}